﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cemit.NetFramework
{
    public static class TypeExtensions
    {
        /// <summary>
        /// 获取嵌套类的最顶层的类
        /// </summary>
        public static Type GetTopDeclaringType(this Type type)
        {
            Type ret = type;
            while (ret.IsNested)
            {
                ret = ret.DeclaringType;
            }
            return ret;
        }
    }
}
